#include "DataLimit.h"


int DataLimit::mEMSDataAccuracyUpperLimit_display=6;//数据显示精度上限
int DataLimit::mEMSDataAccuracyLowerLimit_display=0;//数据显示精度下限
int DataLimit::mEMSDataAccuracyUpperLimit_save=6;//数据保存精度上限
int DataLimit::mEMSDataAccuracyLowerLimit_save=0;//数据保存精度下限

int DataLimit::mEMSData_intervalLowerLimit_collection=1;//数据收集间隔下限
int DataLimit::scriptManage_intervalLowerLimit_turnTableOperationTimeOut=1;//脚本转台操作超时时间下限

int DataLimit::turnTablePositionUpperLimit_max =360;//转台位置上限
int DataLimit::turnTablePositionLowerLimit_min =0;//转台位置下限
int DataLimit::turnTableRateUpperLimit_max =5000;//转台速率上限
int DataLimit::turnTableRateLowerLimit_min =1;//转台速率下限
int DataLimit::turnTableAccelerationUpperLimit_max =100;//转台加速度上限
int DataLimit::turnTableAccelerationLowerLimit_min =1;//转台加速度下限


DataLimit::DataLimit(QObject *parent)
	: QObject(parent)
{
}

DataLimit::~DataLimit()
{
}

int DataLimit::standardizeMEMSDataAccuracy_display(int dataAccuracy_display)
{
	if (dataAccuracy_display>=mEMSDataAccuracyUpperLimit_display)
	{
		return mEMSDataAccuracyUpperLimit_display;
	}
	else if (dataAccuracy_display<=mEMSDataAccuracyLowerLimit_display)
	{
		return mEMSDataAccuracyLowerLimit_display;
	}
	else 
	{
		return dataAccuracy_display;
	}
}
int DataLimit::standardizeMEMSDataAccuracy_save(int dataAccuracy_save)
{
	if (dataAccuracy_save>= mEMSDataAccuracyUpperLimit_save)
	{
		return mEMSDataAccuracyUpperLimit_save;
	}
	else if (dataAccuracy_save<= mEMSDataAccuracyLowerLimit_save)
	{
		return mEMSDataAccuracyLowerLimit_save;
	}
	else
	{
		return dataAccuracy_save;
	}
}
int DataLimit::standardizeMEMSDataCollectionInterval(int mEMSData_interval_collection)
{
	if (mEMSData_interval_collection<= mEMSData_intervalLowerLimit_collection)
	{
		return mEMSData_intervalLowerLimit_collection;
	}
	else
	{
		return mEMSData_interval_collection;
	}
}
int DataLimit::standardizeScriptManageTurnTableOperationTimeOutInterval(int scriptManage_interval_turnTableOperationTimeOut)
{
	if (scriptManage_interval_turnTableOperationTimeOut<= scriptManage_intervalLowerLimit_turnTableOperationTimeOut)
	{
		return scriptManage_intervalLowerLimit_turnTableOperationTimeOut;
	}
	else
	{
		return scriptManage_interval_turnTableOperationTimeOut;
	}

}
int DataLimit::standardizeTurnTablePositionLimit(int turnTablePositionLimit)
{
	if (turnTablePositionLimit >= turnTablePositionUpperLimit_max)
	{
		return turnTablePositionUpperLimit_max;
	}
	else if (turnTablePositionLimit<= turnTablePositionLowerLimit_min)
	{
		return turnTablePositionLowerLimit_min;
	}
	else
	{
		return turnTablePositionLimit;
	}

}
int DataLimit::standardizeTurnTableRateLimit(int turnTableRateLimit)
{
	if (turnTableRateLimit>= turnTableRateUpperLimit_max)
	{
		return turnTableRateUpperLimit_max;
	}
	else if (turnTableRateLimit<= turnTableRateLowerLimit_min)
	{
		return turnTableRateLowerLimit_min;
	}
	else
	{
		return turnTableRateLimit;
	}
}
int DataLimit::standardizeTurnTableAccelerationLimit(int turnTableAccelerationLimit)
{
	if (turnTableAccelerationLimit>= turnTableAccelerationUpperLimit_max)
	{
		return turnTableAccelerationUpperLimit_max;
	}
	else if (turnTableAccelerationLimit<= turnTableAccelerationLowerLimit_min)
	{
		return turnTableAccelerationLowerLimit_min;
	}
	else
	{
		return turnTableAccelerationLimit;
	}
}

int DataLimit::getMEMSDataAccuracyUpperLimit_display()
{
	return mEMSDataAccuracyUpperLimit_display;
}
int DataLimit::getMEMSDataAccuracyLowerLimit_display()
{
	return mEMSDataAccuracyLowerLimit_display;
}
int DataLimit::getMEMSDataAccuracyUpperLimit_save()
{
	return mEMSDataAccuracyUpperLimit_save;
}
int DataLimit::getMEMSDataAccuracyLowerLimit_save()
{
	return mEMSDataAccuracyLowerLimit_save;
}
int DataLimit::getMEMSData_intervalLowerLimit_collection()
{
	return mEMSData_intervalLowerLimit_collection;
}
int DataLimit::getScriptManage_intervalLowerLimit_turnTableOperationTimeOut()
{
	return scriptManage_intervalLowerLimit_turnTableOperationTimeOut;
}
float DataLimit::getTurnTablePositionUpperLimit()
{
	return turnTablePositionUpperLimit_max;
}
float DataLimit::getTurnTablePositionLowerLimit()
{
	return turnTablePositionLowerLimit_min;
}
float DataLimit::getTurnTableRateUpperLimit()
{
	return turnTableRateUpperLimit_max;
}
float DataLimit::getTurnTableRateLowerLimit()
{
	return turnTableRateLowerLimit_min;
}
float DataLimit::getTurnTableAccelerationUpperLimit()
{
	return turnTableAccelerationUpperLimit_max;
}
float DataLimit::getTurnTableAccelerationLowerLimit()
{
	return turnTableAccelerationLowerLimit_min;
}